import time

def get_invest_info(mongo_instance, soup, cid, company):
    print('start 对外投资数据*******')
    for tr in soup.find('div', id='_container_invest').find('tbody').find_all('tr') if soup.find('div',
                                                                                                 id='_container_invest') else []:
        item = {}
        tds = tr.find_all('td')
        if len(tds) > 7:
            item['to_company'] = tds[3].text
            if tds[4].find('a'):
                item['com_legal'] = tds[4].find('a', class_='link-click').text
            else:
                item['com_legal'] = tds[4].text
            item['regist_capital'] = tds[5].text
            item['invest_ratio'] = tds[6].text
            item['regist_date'] = tds[7].text
            item['com_status'] = tds[8].text
            item['create_at'] = int(time.time())
            item['update_at'] = item['create_at']
            item['company'] = company
            item['company_id'] = cid
            print(item)
            mongo_instance.invest.update({'company_id': cid}, item, True)

    print('success 对外投资数据*******')
